<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>区域判断</title>
</head>
<body>
    <div id="container" style="width: 600px; height: 600px;"></div>
    <script src="https://webapi.amap.com/maps?v=2.0&key=ae82f1373cedbca373e78dba0188b6b9&plugin=AMap.Scale,AMap.ToolBar"></script>
    <script>
        var map = new AMap.Map('container', {
            resizeEnable: true,
            center: [116.368904, 39.913423],
            zoom: 12
        });
        var path = [
            new AMap.LngLat(116.368904,39.913423),
            new AMap.LngLat(116.382122,39.901176),
            new AMap.LngLat(116.387271,39.912501),
            new AMap.LngLat(116.398258,39.904600)
        ];

        var polygon = new AMap.Polygon({
            path: path,  
            fillColor: '#fff', // 多边形填充颜色
            borderWeight: 2, // 线条宽度，默认为 1
            strokeColor: 'red', // 线条颜色
        });

        map.add(polygon);
        
        // 116.387396,39.908942
        var lng="116.387396";
        var lat="39.908942";
        map.on("click",function(e){
            console.log(e.lnglat.lng,e.lnglat.lat);
            console.log(polygon.contains([lng,lat]));
        })
    </script>
</body>
</html>